<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>柱状图</title>
    <script src="https://d3js.org/d3.v6.min.js"></script>
    <style>
        #my_chart div {
            display: inline-block;
            background: #4285F4;
            width: 20px;
            margin-right: 3px;
        }
    </style>
</head>

<body>
    <div id="my_chart"></div>
    <script>
        d3.select('#my_chart')
            .selectAll("div")
            .data([14, 38, 15, 16, 13, 42, 16, 13])
            .enter()
            .append("div")
            .style("height", (d) => d * 4 + "px")
    </script>

</body>

</html>